<template>
	<div style="display: inline-block;">
		<button v-if="type !== 'line'" class="hcj_default" :class="[`hcj_default-${type}`,{
				'hcj_defaultRound': round,
				'hcj_disabled': disabled
			}]" 
			:style="{'width': styles.width,
			'height': styles.height,
			'color': styles.color,
			'backgroundColor': styles.bgColor}"
			:disabled="disabled"
			@click="callClick">
			<slot>按钮</slot>
		</button>
		<button v-if=" type== 'line'" class="hcj_animanteSty" :class="[`hcj_default-${type}`,{
				'hcj_defaultRound': round,
				'hcj_disabled': disabled
			}]"
			:style="{'width': styles.width,
			'height': styles.height,
			'color': styles.color,
			'backgroundColor': styles.bgColor}"
			 :disabled="disabled"
			 @click="callClick">
			<slot>按钮</slot>
		</button>
	</div>

</template>
<script>
	export default {
		name: 'hcjButton',
		props: {
			type: {
				type: String,
				default: 'default'
			},
			plan: {
				type: Boolean,
				default: false
			},
			round: {
				type: Boolean,
				default: false
			},
			disabled: {
				type: Boolean,
				default: false
			},
			styles: {
				type: Object,
				default() {
					return {
						width: 100,
						height: '',
						color: '',
						bgColor: ''
					}
				}
			}
		},
		data() {
			return {
			}
		},
		mounted() {},
		methods: {
			callClick() {
				this.$emit('click')
			}
		}
	}
</script>
<style scoped>
	* {
		padding: 0;
		margin: 0;
	}
	/* 按钮btn 基础样式 */
	.hcj_default {
		display: flex;
		justify-content: center;
		align-items: center;
		position: relative;
		padding: 0;
		width: 90px;
		height: 35px;
		line-height: 35px;
		font-size: 0.9em;
		cursor: pointer;
		user-select: none;
		box-sizing: border-box;
		outline: none;
		border: 1px solid gray;
		background-color: #FFFFFF;
		overflow: hidden;
		text-overflow: clip;
		white-space: nowrap;
		text-align: center;
		border-radius: 4px;
		box-shadow: 1px 2px 4px lightgray;
		/* -webkit-text-align-last: justify; */
	}

	.hcj_default:active {
		background-color: #F5F5F5;
		scale: 0.98;
	}

	/* 闪烁 */
	.hcj_default-twinkle {
		overflow: hidden;
		text-overflow: clip;
		white-space: nowrap;
		word-break: keep-all;
		position: relative;
		border: 1px solid gray;
		color: #2c3e50;
		transition: background-color .2s;
	}

	.hcj_default-twinkle::before {
		content: "";
		position: absolute;
		width: 50px;
		height: 200%;
		top: 0;
		background-color: rgba(255, 255, 255, .6);
		transform: skew(45deg) translate3d(-200px, 0, 0);
	}

	.hcj_default-twinkle:hover {
		background-color: #2c3e50;
		color: #FFFFFF;
	}

	.hcj_default-twinkle:hover::before {
		transition: ease-in-out .5s;
		transform: skew(45deg) translate3d(300px, 0, 0);
	}

	/* 填充 */
	.hcj_default-slide {
		border: 1px solid gray;
		color: #2980b9;
		position: relative;
		overflow: hidden;
		z-index: 1;
		transition: .5s;
	}

	.hcj_default-slide::before {
		content: "";
		position: absolute;
		z-index: -1;
		width: 0;
		height: 100%;
		top: 0;
		left: 0;
		background-color: #2980b9;
		transition: ease-in-out .5s;
	}

	.hcj_default-slide:hover::before {
		width: 100%;
	}

	.hcj_default-slide:hover {
		color: #FFFFFF;
	}

	/* 线变 */
	.hcj_animanteSty {
		display: flex;
		justify-content: center;
		align-items: center;
		position: relative;
		padding: 0;
		width: 90px;
		height: 35px;
		line-height: 35px;
		font-size: 0.9em;
		cursor: pointer;
		user-select: none;
		box-sizing: border-box;
		outline: none;
		border: 1px solid gray;
		background-color: #FFFFFF;
		overflow: hidden;
		text-overflow: clip;
		white-space: nowrap;
		text-align: center;
		border-radius: 4px;
		box-shadow: 1px 2px 4px lightgray;
		transition: .5s all;
	}

	.hcj_default-line:hover {
		border: 7px solid transparent;
		box-shadow: 0px 0px 3px gray;
	}
/* 	.hcj_default-line:hover::before {
		content: "";
		position: absolute;
		top: 0px;
		left: 0px;
		width: calc(100% - 2px);
		height: calc(100% - 2px);
		border: 2px solid;
		border-image: linear-gradient(to bottom right, blue, skyblue, deepskyblue);
		border-image-slice: 1;
		opacity: 0.8;
	} */
	.hcj_default-line:active {
		border: 1px solid #2980b9;
		transition: 0s all;
		background-color: #F5F5F5;
	}

	/* 主要按钮 */
	.hcj_default-premary {
		background-color: #2c3e50;
		color: white;
	}
	.hcj_default-premary:active {
		background-color: rgba(44, 62, 80, 0.8);
		color: white;
	}


	/* 圆角 */
	.hcj_defaultRound {
		border-radius: 15px;
	}
	
	/* 禁用 */
	.hcj_disabled {
		cursor: not-allowed;
		border: 2px solid lightgrey;
		background-color: #F5F5F5;
		color: lightgrey;
		/* opacity: 0.7; */
	}
	.hcj_disabled:hover {
		cursor: no-drop;
		color: lightgrey;
		border: 2px solid lightgrey;;
	}
	.hcj_disabled:hover::before {
		color: lightgrey;
		cursor: no-drop;
		border: 0px solid gray;
	}
</style>